#!/bin/bash

##安装
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
sudo bash -c 'curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -'
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y update 
sudo apt-get -y install docker-ce

##配置docker加速地址
sudo touch /etc/docker/daemon.json
sudo tee /etc/docker/daemon.json <<-'EOF'
{ 
        "exec-opts": ["native.cgroupdriver=systemd"],
        "registry-mirrors": ["https://r9xxm8z8.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn" ]
} 
EOF

##启动
sudo systemctl daemon-reload
sudo systemctl restart docker

##检查
sudo docker info
